package com.itheima.springbootwebbtalis.controller;

import com.itheima.springbootwebbtalis.pojo.Result;
import com.itheima.springbootwebbtalis.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/report")
public class ReportController {
    @Autowired
     ReportService reportService;
    // 员工职位人数统计
    @GetMapping("/empJobData")
    public Result jobCount(){
        //2.调用业务层，查询职位统计数据
        Map jobOption=reportService.jobCount();
        return Result.success(jobOption);
    }
    // 员工性别人数统计
    @GetMapping("/empGenderData")
    public Result genderCount(){
        //2.调用业务层，查询职位统计数据
        List<Map> map=reportService.genderCount();
        return Result.success(map);
    }
    // 班级人数统计
    @GetMapping("/studentCountData")
    public Result clazzCount(){
        Map map=reportService.clazzCount();
        return Result.success(map);
    }
   // 学员学历统计
    @GetMapping("/studentDegreeData")
    public Result degreeCount(){
        List<Map> map =reportService.degreeCount();
        return Result.success(map);
    }
}
